
X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
1 
1.03175 
1.0645 
1.09829 
1.13316 
1.16913 
1.20624 
1.24453 
1.28404 
1.3248 
1.36685 
1.41024 
1.45501 
1.50119 
1.54885 
1.59801 
1.64874 
1.70107 
1.75507 
1.81078 
1.86826 
1.92757 
1.98875 
2.05188 
2.11701 
2.18421 
2.25355 
2.32508 
2.39888 
2.47503 
2.55359 
2.63465 
2.71828 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-3.00316
-7.5371
-12.0098
-16.4731
-20.9119
-25.3399
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
1 
1.01575 
1.03174 
1.04799 
1.0645 
1.08126 
1.09829 
1.11558 
1.13315 
1.15099 
1.16912 
1.18753 
1.20623 
1.22523 
1.24452 
1.26412 
1.28403 
1.30425 
1.32479 
1.34565 
1.36684 
1.38837 
1.41023 
1.43244 
1.455 
1.47791 
1.50118 
1.52482 
1.54883 
1.57322 
1.598 
1.62316 
1.64873 
1.67469 
1.70106 
1.72785 
1.75506 
1.7827 
1.81077 
1.83929 
1.86825 
1.89767 
1.92755 
1.95791 
1.98874 
2.02006 
2.05187 
2.08418 
2.117 
2.15034 
2.1842 
2.2186 
2.25354 
2.28903 
2.32507 
2.36169 
2.39888 
2.43665 
2.47503 
2.514 
2.55359 
2.5938 
2.63465 
2.67614 
2.71828 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-2.9421
-7.45438
-11.9093
-16.3573
-20.7857
-25.2156
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
1 
1.00784 
1.01575 
1.02371 
1.03174 
1.03984 
1.04799 
1.05621 
1.06449 
1.07284 
1.08126 
1.08974 
1.09829 
1.1069 
1.11558 
1.12433 
1.13315 
1.14204 
1.15099 
1.16002 
1.16912 
1.17829 
1.18753 
1.19684 
1.20623 
1.21569 
1.22523 
1.23484 
1.24452 
1.25428 
1.26412 
1.27403 
1.28403 
1.2941 
1.30425 
1.31448 
1.32479 
1.33518 
1.34565 
1.3562 
1.36684 
1.37756 
1.38836 
1.39925 
1.41023 
1.42129 
1.43243 
1.44367 
1.45499 
1.4664 
1.47791 
1.4895 
1.50118 
1.51295 
1.52482 
1.53678 
1.54883 
1.56098 
1.57322 
1.58556 
1.598 
1.61053 
1.62316 
1.63589 
1.64872 
1.66165 
1.67469 
1.68782 
1.70106 
1.7144 
1.72785 
1.7414 
1.75506 
1.76882 
1.78269 
1.79668 
1.81077 
1.82497 
1.83928 
1.85371 
1.86825 
1.8829 
1.89767 
1.91255 
1.92755 
1.94267 
1.95791 
1.97326 
1.98874 
2.00434 
2.02006 
2.0359 
2.05187 
2.06796 
2.08418 
2.10053 
2.117 
2.1336 
2.15034 
2.1672 
2.1842 
2.20133 
2.2186 
2.236 
2.25354 
2.27121 
2.28902 
2.30698 
2.32507 
2.34331 
2.36168 
2.38021 
2.39888 
2.41769 
2.43665 
2.45576 
2.47502 
2.49444 
2.514 
2.53372 
2.55359 
2.57362 
2.5938 
2.61415 
2.63465 
2.65531 
2.67614 
2.69713 
2.71828 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-2.91126
-7.41214
-11.8572
-16.2932
-20.7168
-25.1431
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
1 
1.00391 
1.00784 
1.01179 
1.01575 
1.01972 
1.02371 
1.02772 
1.03174 
1.03578 
1.03984 
1.04391 
1.04799 
1.05209 
1.05621 
1.06034 
1.06449 
1.06866 
1.07284 
1.07704 
1.08126 
1.08549 
1.08974 
1.094 
1.09829 
1.10258 
1.1069 
1.11123 
1.11558 
1.11995 
1.12433 
1.12873 
1.13315 
1.13758 
1.14204 
1.14651 
1.15099 
1.1555 
1.16002 
1.16456 
1.16912 
1.17369 
1.17829 
1.1829 
1.18753 
1.19218 
1.19684 
1.20153 
1.20623 
1.21095 
1.21569 
1.22045 
1.22523 
1.23002 
1.23484 
1.23967 
1.24452 
1.24939 
1.25428 
1.25919 
1.26412 
1.26907 
1.27403 
1.27902 
1.28403 
1.28905 
1.2941 
1.29916 
1.30425 
1.30935 
1.31448 
1.31962 
1.32478 
1.32997 
1.33518 
1.3404 
1.34565 
1.35091 
1.3562 
1.36151 
1.36684 
1.37219 
1.37756 
1.38295 
1.38836 
1.3938 
1.39925 
1.40473 
1.41023 
1.41575 
1.42129 
1.42685 
1.43243 
1.43804 
1.44367 
1.44932 
1.45499 
1.46069 
1.4664 
1.47214 
1.4779 
1.48369 
1.4895 
1.49533 
1.50118 
1.50705 
1.51295 
1.51887 
1.52482 
1.53079 
1.53678 
1.54279 
1.54883 
1.55489 
1.56098 
1.56709 
1.57322 
1.57938 
1.58556 
1.59177 
1.598 
1.60425 
1.61053 
1.61683 
1.62316 
1.62951 
1.63589 
1.64229 
1.64872 
1.65517 
1.66165 
1.66816 
1.67469 
1.68124 
1.68782 
1.69443 
1.70106 
1.70772 
1.7144 
1.72111 
1.72785 
1.73461 
1.7414 
1.74821 
1.75505 
1.76192 
1.76882 
1.77574 
1.78269 
1.78967 
1.79667 
1.80371 
1.81077 
1.81785 
1.82497 
1.83211 
1.83928 
1.84648 
1.85371 
1.86096 
1.86825 
1.87556 
1.8829 
1.89027 
1.89767 
1.90509 
1.91255 
1.92004 
1.92755 
1.93509 
1.94267 
1.95027 
1.95791 
1.96557 
1.97326 
1.98098 
1.98874 
1.99652 
2.00434 
2.01218 
2.02006 
2.02796 
2.0359 
2.04387 
2.05187 
2.0599 
2.06796 
2.07605 
2.08418 
2.09234 
2.10053 
2.10875 
2.117 
2.12529 
2.1336 
2.14195 
2.15034 
2.15875 
2.1672 
2.17569 
2.1842 
2.19275 
2.20133 
2.20995 
2.2186 
2.22728 
2.236 
2.24475 
2.25353 
2.26236 
2.27121 
2.2801 
2.28902 
2.29798 
2.30698 
2.31601 
2.32507 
2.33417 
2.34331 
2.35248 
2.36168 
2.37093 
2.38021 
2.38952 
2.39888 
2.40826 
2.41769 
2.42715 
2.43665 
2.44619 
2.45576 
2.46537 
2.47502 
2.48471 
2.49444 
2.5042 
2.514 
2.52384 
2.53372 
2.54363 
2.55359 
2.56358 
2.57362 
2.58369 
2.5938 
2.60395 
2.61415 
2.62438 
2.63465 
2.64496 
2.65531 
2.66571 
2.67614 
2.68661 
2.69713 
2.70768 
2.71828 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-2.89576
-7.38634
-11.8307
-16.257
-20.6812
-25.1005
-29.5207
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd1.png');

N = [
32
64
128
256
];
E = [
-15.826
-17.8303
-19.849
-21.8288
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
3.8e-05
0.000106
0.000665
0.004293
];
T2 = [
0.00163
0.005348
0.020488
0.087837
];
figure(3);
subplot(3,1,1);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0 
0.0317747 
0.0645571 
0.0983789 
0.133273 
0.169274 
0.206417 
0.244738 
0.284274 
0.325064 
0.367147 
0.410566 
0.455361 
0.501578 
0.549261 
0.598456 
0.649211 
0.701577 
0.755604 
0.811345 
0.868854 
0.928187 
0.989403 
1.05256 
1.11772 
1.18495 
1.25431 
1.32588 
1.39971 
1.47589 
1.55448 
1.63557 
1.71923 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-0.0854494
-1.44267
-2.95012
-4.51219
-6.09532
-7.68673
-9.28143
-10.8774
-12.4739
-14.0706
-15.6674
-17.2642
-18.8611
-20.4579
-22.0547
-23.6516
-25.2484
-26.8453
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
0 
0.0157517 
0.0317513 
0.0480029 
0.0645103 
0.0812776 
0.0983088 
0.115608 
0.13318 
0.151028 
0.169158 
0.187573 
0.206277 
0.225277 
0.244575 
0.264177 
0.284088 
0.304312 
0.324855 
0.345721 
0.366916 
0.388444 
0.410312 
0.432524 
0.455085 
0.478001 
0.501279 
0.524923 
0.548939 
0.573333 
0.598112 
0.62328 
0.648845 
0.674812 
0.701189 
0.72798 
0.755193 
0.782835 
0.810912 
0.839431 
0.868399 
0.897824 
0.927711 
0.95807 
0.988906 
1.02023 
1.05204 
1.08436 
1.11718 
1.15052 
1.18439 
1.21879 
1.25373 
1.28922 
1.32527 
1.36189 
1.39909 
1.43687 
1.47524 
1.51422 
1.55381 
1.59403 
1.63488 
1.67637 
1.71852 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
0.106875
-1.14305
-2.58476
-4.10473
-5.65884
-7.22821
-8.80444
-10.3838
-11.9645
-13.5459
-15.1276
-16.7094
-18.2912
-19.8731
-21.455
-23.0369
-24.6188
-26.2007
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
0 
0.00784359 
0.0157487 
0.0237158 
0.0317454 
0.039838 
0.047994 
0.056214 
0.0644984 
0.0728479 
0.0812628 
0.0897437 
0.0982911 
0.106906 
0.115588 
0.124338 
0.133156 
0.142044 
0.151002 
0.16003 
0.169128 
0.178298 
0.18754 
0.196855 
0.206242 
0.215703 
0.225238 
0.234848 
0.244534 
0.254295 
0.264133 
0.274048 
0.284041 
0.294112 
0.304263 
0.314492 
0.324802 
0.335193 
0.345666 
0.35622 
0.366858 
0.377578 
0.388383 
0.399273 
0.410248 
0.421309 
0.432456 
0.443692 
0.455015 
0.466427 
0.477929 
0.48952 
0.501203 
0.512978 
0.524844 
0.536804 
0.548858 
0.561006 
0.573249 
0.585588 
0.598025 
0.610558 
0.62319 
0.635921 
0.648752 
0.661684 
0.674717 
0.687852 
0.70109 
0.714432 
0.727879 
0.741431 
0.75509 
0.768855 
0.782729 
0.796711 
0.810803 
0.825005 
0.839319 
0.853745 
0.868285 
0.882938 
0.897706 
0.91259 
0.927591 
0.942709 
0.957946 
0.973303 
0.98878 
1.00438 
1.0201 
1.03594 
1.05191 
1.068 
1.08422 
1.10057 
1.11705 
1.13365 
1.15038 
1.16725 
1.18425 
1.20138 
1.21865 
1.23605 
1.25358 
1.27126 
1.28907 
1.30703 
1.32512 
1.34336 
1.36174 
1.38026 
1.39893 
1.41774 
1.43671 
1.45582 
1.47508 
1.49449 
1.51406 
1.53377 
1.55365 
1.57367 
1.59386 
1.6142 
1.63471 
1.65537 
1.6762 
1.69719 
1.71834 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
0.262824
-0.886629
-2.26152
-3.73657
-5.25937
-6.80556
-8.36332
-9.92685
-11.4932
-13.061
-14.6296
-16.1984
-17.7675
-19.3366
-20.9058
-22.475
-24.0442
-25.6134
-27.1827
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
0 
0.00391395 
0.00784322 
0.0117879 
0.015748 
0.0197235 
0.0237147 
0.0277215 
0.0317439 
0.0357821 
0.0398361 
0.043906 
0.0479917 
0.0520935 
0.0562114 
0.0603453 
0.0644955 
0.0686618 
0.0728445 
0.0770436 
0.0812591 
0.085491 
0.0897396 
0.0940048 
0.0982866 
0.102585 
0.106901 
0.111233 
0.115582 
0.119949 
0.124332 
0.128733 
0.13315 
0.137586 
0.142038 
0.146508 
0.150995 
0.1555 
0.160023 
0.164563 
0.169121 
0.173697 
0.178291 
0.182902 
0.187532 
0.19218 
0.196846 
0.201531 
0.206233 
0.210954 
0.215694 
0.220452 
0.225229 
0.230024 
0.234839 
0.239672 
0.244524 
0.249395 
0.254285 
0.259194 
0.264122 
0.26907 
0.274037 
0.279023 
0.284029 
0.289055 
0.2941 
0.299165 
0.30425 
0.309355 
0.31448 
0.319624 
0.324789 
0.329974 
0.33518 
0.340406 
0.345652 
0.350919 
0.356206 
0.361514 
0.366843 
0.372193 
0.377563 
0.382955 
0.388368 
0.393802 
0.399257 
0.404733 
0.410231 
0.415751 
0.421292 
0.426855 
0.43244 
0.438046 
0.443674 
0.449325 
0.454997 
0.460692 
0.466409 
0.472148 
0.47791 
0.483695 
0.489502 
0.495332 
0.501184 
0.50706 
0.512958 
0.51888 
0.524825 
0.530793 
0.536784 
0.542799 
0.548837 
0.554899 
0.560985 
0.567094 
0.573228 
0.579385 
0.585567 
0.591773 
0.598003 
0.604257 
0.610536 
0.61684 
0.623168 
0.629521 
0.635898 
0.642301 
0.648729 
0.655182 
0.66166 
0.668164 
0.674693 
0.681247 
0.687828 
0.694434 
0.701066 
0.707723 
0.714407 
0.721117 
0.727854 
0.734616 
0.741405 
0.748221 
0.755063 
0.761933 
0.768829 
0.775752 
0.782702 
0.789679 
0.796684 
0.803716 
0.810775 
0.817862 
0.824977 
0.83212 
0.839291 
0.84649 
0.853717 
0.860972 
0.868256 
0.875568 
0.882909 
0.890278 
0.897676 
0.905104 
0.91256 
0.920046 
0.927561 
0.935105 
0.942679 
0.950282 
0.957915 
0.965578 
0.973271 
0.980995 
0.988748 
0.996532 
1.00435 
1.01219 
1.02007 
1.02797 
1.03591 
1.04388 
1.05188 
1.05991 
1.06797 
1.07606 
1.08419 
1.09235 
1.10054 
1.10876 
1.11701 
1.1253 
1.13362 
1.14197 
1.15035 
1.15877 
1.16722 
1.1757 
1.18421 
1.19276 
1.20134 
1.20996 
1.21861 
1.22729 
1.23601 
1.24476 
1.25355 
1.26237 
1.27122 
1.28011 
1.28904 
1.29799 
1.30699 
1.31602 
1.32508 
1.33418 
1.34332 
1.35249 
1.3617 
1.37094 
1.38022 
1.38954 
1.39889 
1.40828 
1.4177 
1.42717 
1.43667 
1.4462 
1.45578 
1.46539 
1.47504 
1.48472 
1.49445 
1.50421 
1.51401 
1.52385 
1.53373 
1.54365 
1.5536 
1.5636 
1.57363 
1.5837 
1.59382 
1.60397 
1.61416 
1.62439 
1.63466 
1.64498 
1.65533 
1.66572 
1.67615 
1.68663 
1.69714 
1.7077 
1.7183 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
0.391637
-0.66463
-1.97318
-3.40151
-4.89103
-6.41271
-7.95152
-9.49948
-11.0524
-12.6079
-14.1648
-15.7225
-17.2806
-18.8389
-20.3973
-21.9558
-23.5144
-25.0729
-26.6315
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd2.png');

N = [
32
64
128
256
];
E = [
-10.0463
-12.0309
-14.0232
-16.0201
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.6e-05
0.000161
0.000581
0.00377
];
T2 = [
0.004266
0.013925
0.051023
0.227081
];
figure(3);
subplot(3,1,2);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0.999725 
1.03148 
1.06424 
1.09804 
1.13291 
1.16889 
1.20602 
1.24432 
1.28383 
1.3246 
1.36666 
1.41006 
1.45484 
1.50103 
1.54869 
1.59787 
1.6486 
1.70095 
1.75495 
1.81067 
1.86816 
1.92747 
1.98867 
2.0518 
2.11695 
2.18415 
2.25349 
2.32504 
2.39885 
2.475 
2.55358 
2.63464 
2.71828 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-2.86504
-6.60365
-7.00441
-8.31173
-9.80842
-11.3675
-12.9496
-14.5407
-16.1352
-17.7312
-19.3276
-20.9243
-22.5211
-24.1179
-25.7148
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
0.999932 
1.01568 
1.03168 
1.04793 
1.06443 
1.0812 
1.09823 
1.11552 
1.13309 
1.15094 
1.16906 
1.18748 
1.20618 
1.22517 
1.24447 
1.26407 
1.28398 
1.3042 
1.32474 
1.3456 
1.36679 
1.38832 
1.41019 
1.43239 
1.45495 
1.47787 
1.50114 
1.52478 
1.5488 
1.57319 
1.59796 
1.62313 
1.64869 
1.67466 
1.70103 
1.72782 
1.75503 
1.78267 
1.81074 
1.83926 
1.86822 
1.89765 
1.92753 
1.95789 
1.98872 
2.02004 
2.05185 
2.08416 
2.11699 
2.15033 
2.18419 
2.21859 
2.25352 
2.28901 
2.32506 
2.36168 
2.39887 
2.43665 
2.47502 
2.514 
2.55359 
2.5938 
2.63465 
2.67614 
2.71828 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-2.89672
-4.55613
-5.52538
-6.89473
-8.38921
-9.93308
-11.4981
-13.0724
-14.6509
-16.2312
-17.8124
-19.394
-20.9758
-22.5576
-24.1395
-25.7213
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
0.999983 
1.00783 
1.01573 
1.0237 
1.03173 
1.03982 
1.04798 
1.05619 
1.06448 
1.07283 
1.08124 
1.08972 
1.09827 
1.10688 
1.11557 
1.12432 
1.13313 
1.14202 
1.15098 
1.16001 
1.1691 
1.17827 
1.18752 
1.19683 
1.20622 
1.21568 
1.22521 
1.23482 
1.24451 
1.25427 
1.26411 
1.27402 
1.28401 
1.29408 
1.30423 
1.31446 
1.32477 
1.33516 
1.34564 
1.35619 
1.36683 
1.37755 
1.38835 
1.39924 
1.41022 
1.42128 
1.43242 
1.44366 
1.45498 
1.46639 
1.47789 
1.48949 
1.50117 
1.51294 
1.52481 
1.53677 
1.54882 
1.56097 
1.57321 
1.58555 
1.59799 
1.61052 
1.62315 
1.63588 
1.64871 
1.66165 
1.67468 
1.68781 
1.70105 
1.71439 
1.72784 
1.74139 
1.75505 
1.76881 
1.78269 
1.79667 
1.81076 
1.82496 
1.83928 
1.8537 
1.86824 
1.88289 
1.89766 
1.91255 
1.92755 
1.94266 
1.9579 
1.97326 
1.98873 
2.00433 
2.02005 
2.0359 
2.05186 
2.06796 
2.08418 
2.10052 
2.117 
2.1336 
2.15033 
2.1672 
2.1842 
2.20133 
2.21859 
2.236 
2.25353 
2.27121 
2.28902 
2.30697 
2.32507 
2.3433 
2.36168 
2.38021 
2.39887 
2.41769 
2.43665 
2.45576 
2.47502 
2.49443 
2.514 
2.53372 
2.55359 
2.57362 
2.5938 
2.61415 
2.63465 
2.65531 
2.67614 
2.69713 
2.71828 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-2.89871
-3.73672
-4.75384
-6.10253
-7.57096
-9.09184
-10.6374
-12.1949
-13.7584
-15.3247
-16.8925
-18.461
-20.0299
-21.5989
-23.1681
-24.7373
-26.3065
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
0.999996 
1.00391 
1.00784 
1.01178 
1.01574 
1.01972 
1.02371 
1.02772 
1.03174 
1.03578 
1.03983 
1.0439 
1.04799 
1.05209 
1.05621 
1.06034 
1.06449 
1.06866 
1.07284 
1.07704 
1.08125 
1.08549 
1.08973 
1.094 
1.09828 
1.10258 
1.1069 
1.11123 
1.11558 
1.11994 
1.12433 
1.12873 
1.13314 
1.13758 
1.14203 
1.1465 
1.15099 
1.15549 
1.16002 
1.16456 
1.16912 
1.17369 
1.17828 
1.1829 
1.18753 
1.19217 
1.19684 
1.20152 
1.20623 
1.21095 
1.21569 
1.22045 
1.22522 
1.23002 
1.23483 
1.23967 
1.24452 
1.24939 
1.25428 
1.25919 
1.26412 
1.26906 
1.27403 
1.27902 
1.28402 
1.28905 
1.29409 
1.29916 
1.30424 
1.30935 
1.31447 
1.31962 
1.32478 
1.32997 
1.33517 
1.3404 
1.34564 
1.35091 
1.3562 
1.36151 
1.36684 
1.37218 
1.37756 
1.38295 
1.38836 
1.39379 
1.39925 
1.40473 
1.41022 
1.41574 
1.42128 
1.42685 
1.43243 
1.43804 
1.44367 
1.44932 
1.45499 
1.46068 
1.4664 
1.47214 
1.4779 
1.48369 
1.48949 
1.49532 
1.50118 
1.50705 
1.51295 
1.51887 
1.52482 
1.53078 
1.53678 
1.54279 
1.54883 
1.55489 
1.56098 
1.56709 
1.57322 
1.57938 
1.58556 
1.59176 
1.59799 
1.60425 
1.61053 
1.61683 
1.62316 
1.62951 
1.63589 
1.64229 
1.64872 
1.65517 
1.66165 
1.66815 
1.67468 
1.68124 
1.68782 
1.69442 
1.70106 
1.70771 
1.7144 
1.72111 
1.72784 
1.73461 
1.7414 
1.74821 
1.75505 
1.76192 
1.76882 
1.77574 
1.78269 
1.78967 
1.79667 
1.80371 
1.81076 
1.81785 
1.82497 
1.83211 
1.83928 
1.84648 
1.85371 
1.86096 
1.86824 
1.87556 
1.8829 
1.89027 
1.89767 
1.90509 
1.91255 
1.92003 
1.92755 
1.93509 
1.94267 
1.95027 
1.9579 
1.96557 
1.97326 
1.98098 
1.98874 
1.99652 
2.00433 
2.01218 
2.02005 
2.02796 
2.0359 
2.04387 
2.05187 
2.0599 
2.06796 
2.07605 
2.08418 
2.09234 
2.10052 
2.10875 
2.117 
2.12528 
2.1336 
2.14195 
2.15034 
2.15875 
2.1672 
2.17568 
2.1842 
2.19275 
2.20133 
2.20995 
2.2186 
2.22728 
2.236 
2.24475 
2.25353 
2.26235 
2.27121 
2.2801 
2.28902 
2.29798 
2.30698 
2.316 
2.32507 
2.33417 
2.3433 
2.35248 
2.36168 
2.37093 
2.38021 
2.38952 
2.39887 
2.40826 
2.41769 
2.42715 
2.43665 
2.44619 
2.45576 
2.46537 
2.47502 
2.48471 
2.49444 
2.5042 
2.514 
2.52384 
2.53372 
2.54363 
2.55359 
2.56358 
2.57362 
2.58369 
2.5938 
2.60395 
2.61415 
2.62438 
2.63465 
2.64496 
2.65531 
2.66571 
2.67614 
2.68661 
2.69713 
2.70768 
2.71828 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-2.89396
-3.20988
-4.21152
-5.52523
-6.96266
-8.4586
-9.98415
-11.5252
-13.0743
-14.6279
-16.1837
-17.7409
-19.2987
-20.8568
-22.4152
-23.9736
-25.5321
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd3.png');

N = [
32
64
128
256
];
E = [
-11.8295
-13.8503
-15.8612
-17.8723
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.7e-05
8e-05
0.000632
0.003886
];
T2 = [
0.003968
0.013558
0.050985
0.19649
];
figure(3);
subplot(3,1,3);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

figure(2);
title('Convergence rates');
legend('Dirichlet', 'Neumann', 'Mixed');
xlabel('log n');
ylabel('log of error');
saveas(gcf,'oneErrorInd1.png');
clf;
figure(3);
subplot(3,1,1);
title('Dirichlet');
subplot(3,1,2);
title('Neumann');
subplot(3,1,3);
title('Mixed');
saveas(gcf,'oneTimeInd1.png');
clf;

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0 
0.0312453 
0.0624601 
0.0936139 
0.124676 
0.155617 
0.186406 
0.217012 
0.247407 
0.27756 
0.307442 
0.337024 
0.366277 
0.395172 
0.423681 
0.451776 
0.47943 
0.506616 
0.533308 
0.559478 
0.585102 
0.610155 
0.634612 
0.658449 
0.681643 
0.704171 
0.726012 
0.747144 
0.767546 
0.787199 
0.806083 
0.824179 
0.841471 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-4.65868
-9.18248
-13.6488
-18.1103
-22.5495
-26.9807
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
0 
0.0156244 
0.031245 
0.046858 
0.0624595 
0.0780458 
0.093613 
0.109157 
0.124675 
0.140162 
0.155615 
0.171031 
0.186404 
0.201732 
0.21701 
0.232236 
0.247405 
0.262513 
0.277558 
0.292534 
0.307439 
0.32227 
0.337021 
0.35169 
0.366274 
0.380767 
0.395168 
0.409473 
0.423677 
0.437778 
0.451773 
0.465657 
0.479427 
0.49308 
0.506613 
0.520022 
0.533304 
0.546456 
0.559474 
0.572356 
0.585098 
0.597698 
0.610151 
0.622456 
0.634608 
0.646606 
0.658445 
0.670124 
0.68164 
0.692989 
0.704168 
0.715176 
0.72601 
0.736665 
0.747142 
0.757435 
0.767544 
0.777466 
0.787197 
0.796737 
0.806081 
0.81523 
0.824179 
0.832926 
0.841471 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-4.61292
-9.11705
-13.5645
-18.0055
-22.4278
-26.8558
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
0 
0.00781243 
0.0156244 
0.0234354 
0.0312449 
0.0390526 
0.0468579 
0.0546603 
0.0624594 
0.0702546 
0.0780456 
0.0858318 
0.0936128 
0.101388 
0.109157 
0.11692 
0.124675 
0.132422 
0.140162 
0.147893 
0.155615 
0.163328 
0.17103 
0.178722 
0.186403 
0.194073 
0.201731 
0.209377 
0.21701 
0.224629 
0.232235 
0.239827 
0.247404 
0.254966 
0.262513 
0.270043 
0.277557 
0.285054 
0.292534 
0.299995 
0.307439 
0.314863 
0.322269 
0.329655 
0.33702 
0.344365 
0.351689 
0.358992 
0.366273 
0.373531 
0.380767 
0.387979 
0.395168 
0.402332 
0.409472 
0.416587 
0.423677 
0.43074 
0.437778 
0.444788 
0.451772 
0.458728 
0.465656 
0.472555 
0.479426 
0.486267 
0.493079 
0.499861 
0.506612 
0.513332 
0.520021 
0.526678 
0.533303 
0.539895 
0.546455 
0.552981 
0.559473 
0.565932 
0.572355 
0.578744 
0.585098 
0.591415 
0.597697 
0.603942 
0.61015 
0.616321 
0.622455 
0.62855 
0.634607 
0.640626 
0.646605 
0.652545 
0.658445 
0.664304 
0.670124 
0.675902 
0.681639 
0.687334 
0.692988 
0.698599 
0.704168 
0.709693 
0.715176 
0.720614 
0.726009 
0.731359 
0.736665 
0.741926 
0.747141 
0.752311 
0.757435 
0.762513 
0.767544 
0.772528 
0.777465 
0.782355 
0.787197 
0.791991 
0.796736 
0.801433 
0.806081 
0.81068 
0.815229 
0.819729 
0.824178 
0.828578 
0.832926 
0.837224 
0.841471 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-4.59184
-9.08502
-13.5284
-17.9561
-22.3787
-26.7985
-31.2167
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
0 
0.00390624 
0.00781242 
0.0117185 
0.0156244 
0.01953 
0.0234354 
0.0273403 
0.0312449 
0.035149 
0.0390526 
0.0429555 
0.0468578 
0.0507594 
0.0546603 
0.0585602 
0.0624593 
0.0663575 
0.0702546 
0.0741506 
0.0780456 
0.0819393 
0.0858318 
0.0897229 
0.0936127 
0.0975011 
0.101388 
0.105273 
0.109157 
0.113039 
0.116919 
0.120798 
0.124675 
0.12855 
0.132422 
0.136293 
0.140162 
0.144029 
0.147893 
0.151755 
0.155615 
0.159472 
0.163328 
0.16718 
0.17103 
0.174877 
0.178722 
0.182564 
0.186403 
0.19024 
0.194073 
0.197904 
0.201731 
0.205555 
0.209377 
0.213195 
0.21701 
0.220821 
0.224629 
0.228434 
0.232235 
0.236033 
0.239827 
0.243617 
0.247404 
0.251187 
0.254966 
0.258741 
0.262512 
0.26628 
0.270043 
0.273802 
0.277557 
0.281307 
0.285054 
0.288796 
0.292533 
0.296267 
0.299995 
0.303719 
0.307439 
0.311153 
0.314863 
0.318568 
0.322269 
0.325964 
0.329654 
0.33334 
0.33702 
0.340695 
0.344365 
0.34803 
0.351689 
0.355343 
0.358992 
0.362635 
0.366273 
0.369905 
0.373531 
0.377152 
0.380766 
0.384376 
0.387979 
0.391576 
0.395167 
0.398753 
0.402332 
0.405905 
0.409472 
0.413032 
0.416587 
0.420135 
0.423676 
0.427211 
0.43074 
0.434262 
0.437777 
0.441286 
0.444788 
0.448283 
0.451772 
0.455253 
0.458727 
0.462195 
0.465655 
0.469109 
0.472555 
0.475994 
0.479426 
0.48285 
0.486267 
0.489677 
0.493079 
0.496473 
0.49986 
0.50324 
0.506612 
0.509976 
0.513332 
0.51668 
0.520021 
0.523353 
0.526678 
0.529994 
0.533303 
0.536603 
0.539895 
0.543179 
0.546455 
0.549722 
0.552981 
0.556231 
0.559473 
0.562707 
0.565931 
0.569148 
0.572355 
0.575554 
0.578744 
0.581925 
0.585097 
0.588261 
0.591415 
0.59456 
0.597697 
0.600824 
0.603942 
0.607051 
0.61015 
0.61324 
0.616321 
0.619393 
0.622455 
0.625507 
0.62855 
0.631583 
0.634607 
0.637621 
0.640625 
0.64362 
0.646605 
0.64958 
0.652545 
0.655499 
0.658444 
0.661379 
0.664304 
0.667219 
0.670123 
0.673018 
0.675902 
0.678775 
0.681639 
0.684492 
0.687334 
0.690166 
0.692988 
0.695799 
0.698599 
0.701389 
0.704168 
0.706936 
0.709693 
0.71244 
0.715175 
0.7179 
0.720614 
0.723317 
0.726009 
0.728689 
0.731359 
0.734017 
0.736665 
0.739301 
0.741925 
0.744539 
0.747141 
0.749732 
0.752311 
0.754878 
0.757435 
0.759979 
0.762512 
0.765034 
0.767544 
0.770042 
0.772528 
0.775002 
0.777465 
0.779916 
0.782355 
0.784782 
0.787197 
0.7896 
0.791991 
0.794369 
0.796736 
0.799091 
0.801433 
0.803763 
0.806081 
0.808387 
0.81068 
0.812961 
0.815229 
0.817485 
0.819729 
0.82196 
0.824178 
0.826384 
0.828578 
0.830758 
0.832926 
0.835082 
0.837224 
0.839354 
0.841471 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-4.58174
-9.06783
-13.5117
-17.9333
-22.3548
-26.7713
-31.1908
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd4.png');

N = [
32
64
128
256
];
E = [
-17.6461
-19.6513
-21.6453
-23.6492
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.7e-05
0.000102
0.000493
0.003901
];
T2 = [
0.0024
0.005561
0.021548
0.081644
];
figure(3);
subplot(3,1,1);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0 
0.0312404 
0.0624503 
0.0935991 
0.124657 
0.155592 
0.186376 
0.216978 
0.247368 
0.277516 
0.307393 
0.33697 
0.366217 
0.395108 
0.423612 
0.451702 
0.479351 
0.506532 
0.533219 
0.559384 
0.585003 
0.610051 
0.634503 
0.658335 
0.681525 
0.704048 
0.725884 
0.747011 
0.767408 
0.787056 
0.805935 
0.824026 
0.841313 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-1.58822
-3.07702
-4.63041
-6.20986
-7.79977
-9.39385
-10.9896
-12.586
-14.1827
-15.7794
-17.3763
-18.9731
-20.5699
-22.1668
-23.7636
-25.3605
-26.9573
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
0 
0.0156238 
0.0312438 
0.0468562 
0.0624571 
0.0780428 
0.0936094 
0.109153 
0.12467 
0.140157 
0.155609 
0.171024 
0.186397 
0.201724 
0.217002 
0.232227 
0.247395 
0.262503 
0.277547 
0.292523 
0.307427 
0.322257 
0.337008 
0.351676 
0.366259 
0.380752 
0.395153 
0.409457 
0.42366 
0.437761 
0.451755 
0.465638 
0.479407 
0.49306 
0.506592 
0.520001 
0.533282 
0.546433 
0.559451 
0.572333 
0.585074 
0.597673 
0.610126 
0.62243 
0.634582 
0.646579 
0.658418 
0.670096 
0.681611 
0.692959 
0.704138 
0.715145 
0.725978 
0.736633 
0.747109 
0.757402 
0.76751 
0.777431 
0.787162 
0.796701 
0.806045 
0.815193 
0.824141 
0.832888 
0.841432 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-1.48055
-2.89097
-4.39319
-5.93851
-7.50372
-9.07803
-10.6565
-12.2368
-13.818
-15.3996
-16.9814
-18.5632
-20.1451
-21.7269
-23.3088
-24.8907
-26.4726
-28.0545
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
0 
0.00781235 
0.0156242 
0.0234351 
0.0312446 
0.0390522 
0.0468574 
0.0546598 
0.0624588 
0.070254 
0.0780449 
0.085831 
0.0936119 
0.101387 
0.109156 
0.116918 
0.124674 
0.132421 
0.140161 
0.147892 
0.155614 
0.163326 
0.171029 
0.178721 
0.186402 
0.194071 
0.201729 
0.209375 
0.217008 
0.224627 
0.232233 
0.239825 
0.247402 
0.254964 
0.26251 
0.27004 
0.277554 
0.285051 
0.292531 
0.299992 
0.307436 
0.31486 
0.322266 
0.329651 
0.337017 
0.344362 
0.351686 
0.358989 
0.366269 
0.373527 
0.380763 
0.387975 
0.395164 
0.402328 
0.409468 
0.416583 
0.423672 
0.430736 
0.437773 
0.444784 
0.451767 
0.458723 
0.465651 
0.47255 
0.479421 
0.486262 
0.493074 
0.499856 
0.506607 
0.513327 
0.520016 
0.526673 
0.533298 
0.53989 
0.546449 
0.552975 
0.559468 
0.565926 
0.57235 
0.578738 
0.585092 
0.591409 
0.597691 
0.603936 
0.610144 
0.616315 
0.622448 
0.628544 
0.634601 
0.640619 
0.646598 
0.652538 
0.658438 
0.664297 
0.670117 
0.675895 
0.681632 
0.687327 
0.692981 
0.698592 
0.70416 
0.709686 
0.715168 
0.720607 
0.726001 
0.731351 
0.736657 
0.741918 
0.747133 
0.752303 
0.757427 
0.762504 
0.767535 
0.77252 
0.777457 
0.782346 
0.787188 
0.791982 
0.796727 
0.801424 
0.806072 
0.810671 
0.81522 
0.81972 
0.824169 
0.828568 
0.832917 
0.837215 
0.841461 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-1.38696
-2.71762
-4.16363
-5.67033
-7.20807
-8.76151
-10.3228
-11.8881
-13.4554
-15.0236
-16.5924
-18.1614
-19.7305
-21.2996
-22.8688
-24.438
-26.0072
-27.5765
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
0 
0.00390623 
0.0078124 
0.0117185 
0.0156243 
0.01953 
0.0234353 
0.0273403 
0.0312448 
0.0351489 
0.0390525 
0.0429554 
0.0468577 
0.0507593 
0.0546601 
0.0585601 
0.0624592 
0.0663573 
0.0702544 
0.0741505 
0.0780454 
0.0819391 
0.0858316 
0.0897227 
0.0936125 
0.0975009 
0.101388 
0.105273 
0.109157 
0.113039 
0.116919 
0.120798 
0.124674 
0.128549 
0.132422 
0.136293 
0.140162 
0.144028 
0.147893 
0.151755 
0.155615 
0.159472 
0.163327 
0.16718 
0.17103 
0.174877 
0.178722 
0.182564 
0.186403 
0.190239 
0.194073 
0.197903 
0.201731 
0.205555 
0.209376 
0.213194 
0.217009 
0.220821 
0.224629 
0.228433 
0.232235 
0.236032 
0.239826 
0.243617 
0.247403 
0.251186 
0.254965 
0.258741 
0.262512 
0.266279 
0.270042 
0.273801 
0.277556 
0.281307 
0.285053 
0.288795 
0.292533 
0.296266 
0.299994 
0.303718 
0.307438 
0.311153 
0.314862 
0.318568 
0.322268 
0.325963 
0.329654 
0.333339 
0.337019 
0.340694 
0.344364 
0.348029 
0.351688 
0.355342 
0.358991 
0.362634 
0.366272 
0.369904 
0.37353 
0.377151 
0.380766 
0.384375 
0.387978 
0.391575 
0.395166 
0.398752 
0.402331 
0.405904 
0.409471 
0.413031 
0.416586 
0.420134 
0.423675 
0.42721 
0.430739 
0.434261 
0.437776 
0.441285 
0.444787 
0.448282 
0.45177 
0.455252 
0.458726 
0.462194 
0.465654 
0.469108 
0.472554 
0.475993 
0.479424 
0.482849 
0.486266 
0.489675 
0.493078 
0.496472 
0.499859 
0.503239 
0.50661 
0.509974 
0.51333 
0.516679 
0.520019 
0.523352 
0.526676 
0.529993 
0.533301 
0.536602 
0.539894 
0.543178 
0.546453 
0.549721 
0.552979 
0.55623 
0.559472 
0.562705 
0.56593 
0.569146 
0.572354 
0.575552 
0.578742 
0.581924 
0.585096 
0.588259 
0.591414 
0.594559 
0.597695 
0.600822 
0.60394 
0.607049 
0.610149 
0.613239 
0.61632 
0.619391 
0.622453 
0.625506 
0.628548 
0.631582 
0.634606 
0.63762 
0.640624 
0.643618 
0.646603 
0.649578 
0.652543 
0.655498 
0.658443 
0.661378 
0.664302 
0.667217 
0.670122 
0.673016 
0.6759 
0.678774 
0.681637 
0.68449 
0.687332 
0.690164 
0.692986 
0.695797 
0.698597 
0.701387 
0.704166 
0.706934 
0.709691 
0.712438 
0.715174 
0.717898 
0.720612 
0.723315 
0.726007 
0.728687 
0.731357 
0.734016 
0.736663 
0.739299 
0.741923 
0.744537 
0.747139 
0.74973 
0.752309 
0.754876 
0.757433 
0.759977 
0.76251 
0.765032 
0.767541 
0.770039 
0.772526 
0.775 
0.777463 
0.779914 
0.782353 
0.78478 
0.787195 
0.789597 
0.791988 
0.794367 
0.796734 
0.799089 
0.801431 
0.803761 
0.806079 
0.808384 
0.810678 
0.812959 
0.815227 
0.817483 
0.819727 
0.821958 
0.824176 
0.826382 
0.828575 
0.830756 
0.832924 
0.835079 
0.837222 
0.839352 
0.841469 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-1.30594
-2.55845
-3.94551
-5.41007
-6.91757
-8.44852
-9.99219
-11.5427
-13.097
-14.6532
-16.2106
-17.7685
-19.3267
-20.8851
-22.4435
-24.002
-25.5606
-27.1191
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd5.png');

N = [
32
64
128
256
];
E = [
-12.6301
-14.6593
-16.6737
-18.6779
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.8e-05
8.1e-05
0.000587
0.003975
];
T2 = [
0.004262
0.015181
0.051784
0.208367
];
figure(3);
subplot(3,1,2);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0.000338344 
0.0315731 
0.0627773 
0.0939206 
0.124972 
0.155902 
0.186681 
0.217277 
0.247661 
0.277803 
0.307675 
0.337246 
0.366488 
0.395373 
0.423871 
0.451956 
0.479599 
0.506775 
0.533456 
0.559615 
0.585229 
0.610271 
0.634717 
0.658544 
0.681727 
0.704245 
0.726076 
0.747197 
0.767588 
0.78723 
0.806104 
0.82419 
0.841471 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-2.38982
-3.48162
-4.9159
-6.45255
-8.02612
-9.61382
-11.2071
-12.8025
-14.3987
-15.9954
-17.5921
-19.1889
-20.7857
-22.3826
-23.9794
-25.5763
-27.1731
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
8.4604e-05 
0.0157077 
0.031327 
0.0469386 
0.0625388 
0.0781238 
0.0936897 
0.109233 
0.124749 
0.140235 
0.155687 
0.171101 
0.186473 
0.201799 
0.217076 
0.232301 
0.247468 
0.262575 
0.277618 
0.292594 
0.307498 
0.322326 
0.337077 
0.351744 
0.366326 
0.380819 
0.395219 
0.409522 
0.423725 
0.437825 
0.451818 
0.4657 
0.479469 
0.493121 
0.506652 
0.52006 
0.533341 
0.546492 
0.559509 
0.572389 
0.58513 
0.597728 
0.61018 
0.622483 
0.634635 
0.646631 
0.658469 
0.670147 
0.681661 
0.693009 
0.704187 
0.715193 
0.726025 
0.73668 
0.747155 
0.757447 
0.767555 
0.777475 
0.787205 
0.796743 
0.806087 
0.815234 
0.824181 
0.832928 
0.841471 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-2.05095
-3.04587
-4.41381
-5.9059
-7.44834
-9.0126
-10.5866
-12.1649
-13.7452
-15.3263
-16.9079
-18.4897
-20.0715
-21.6534
-23.2352
-24.8171
-26.399
-27.9809
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
2.11571e-05 
0.00783342 
0.0156452 
0.023456 
0.0312654 
0.0390729 
0.046878 
0.0546803 
0.0624792 
0.0702743 
0.0780651 
0.0858512 
0.093632 
0.101407 
0.109176 
0.116938 
0.124693 
0.132441 
0.14018 
0.147911 
0.155633 
0.163345 
0.171048 
0.17874 
0.186421 
0.19409 
0.201748 
0.209394 
0.217026 
0.224646 
0.232251 
0.239843 
0.24742 
0.254982 
0.262528 
0.270058 
0.277572 
0.285069 
0.292548 
0.30001 
0.307453 
0.314878 
0.322283 
0.329669 
0.337034 
0.344379 
0.351703 
0.359005 
0.366286 
0.373544 
0.38078 
0.387992 
0.39518 
0.402345 
0.409484 
0.416599 
0.423688 
0.430752 
0.437789 
0.4448 
0.451783 
0.458739 
0.465667 
0.472566 
0.479436 
0.486278 
0.493089 
0.499871 
0.506622 
0.513342 
0.52003 
0.526687 
0.533312 
0.539905 
0.546464 
0.55299 
0.559482 
0.56594 
0.572364 
0.578752 
0.585106 
0.591423 
0.597705 
0.60395 
0.610158 
0.616329 
0.622462 
0.628557 
0.634614 
0.640632 
0.646611 
0.652551 
0.658451 
0.66431 
0.670129 
0.675907 
0.681644 
0.68734 
0.692993 
0.698604 
0.704172 
0.709698 
0.71518 
0.720618 
0.726013 
0.731363 
0.736669 
0.741929 
0.747144 
0.752314 
0.757438 
0.762515 
0.767546 
0.77253 
0.777467 
0.782357 
0.787199 
0.791992 
0.796738 
0.801435 
0.806083 
0.810681 
0.81523 
0.81973 
0.824179 
0.828578 
0.832927 
0.837224 
0.841471 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-1.80242
-2.70376
-4.00498
-5.45064
-6.96024
-8.50017
-10.0549
-11.6169
-13.1826
-14.75
-16.3183
-17.8871
-19.4561
-21.0252
-22.5944
-24.1636
-25.7328
-27.302
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
5.29094e-06 
0.00391151 
0.00781767 
0.0117237 
0.0156296 
0.0195352 
0.0234405 
0.0273455 
0.03125 
0.0351541 
0.0390577 
0.0429606 
0.0468629 
0.0507645 
0.0546653 
0.0585652 
0.0624643 
0.0663624 
0.0702595 
0.0741555 
0.0780504 
0.0819442 
0.0858366 
0.0897278 
0.0936175 
0.0975059 
0.101393 
0.105278 
0.109162 
0.113044 
0.116924 
0.120803 
0.124679 
0.128554 
0.132427 
0.136298 
0.140167 
0.144033 
0.147898 
0.15176 
0.155619 
0.159477 
0.163332 
0.167184 
0.171034 
0.174882 
0.178726 
0.182568 
0.186408 
0.190244 
0.194077 
0.197908 
0.201735 
0.20556 
0.209381 
0.213199 
0.217014 
0.220825 
0.224633 
0.228438 
0.232239 
0.236037 
0.239831 
0.243621 
0.247408 
0.251191 
0.25497 
0.258745 
0.262516 
0.266284 
0.270047 
0.273806 
0.277561 
0.281311 
0.285058 
0.2888 
0.292537 
0.29627 
0.299999 
0.303723 
0.307442 
0.311157 
0.314867 
0.318572 
0.322272 
0.325968 
0.329658 
0.333343 
0.337024 
0.340699 
0.344369 
0.348033 
0.351693 
0.355347 
0.358995 
0.362638 
0.366276 
0.369908 
0.373534 
0.377155 
0.38077 
0.384379 
0.387982 
0.391579 
0.395171 
0.398756 
0.402335 
0.405908 
0.409475 
0.413036 
0.41659 
0.420138 
0.423679 
0.427214 
0.430743 
0.434265 
0.43778 
0.441289 
0.444791 
0.448286 
0.451774 
0.455256 
0.45873 
0.462198 
0.465658 
0.469111 
0.472558 
0.475997 
0.479428 
0.482853 
0.48627 
0.489679 
0.493081 
0.496476 
0.499863 
0.503242 
0.506614 
0.509978 
0.513334 
0.516683 
0.520023 
0.523356 
0.52668 
0.529997 
0.533305 
0.536605 
0.539897 
0.543181 
0.546457 
0.549724 
0.552983 
0.556233 
0.559475 
0.562709 
0.565934 
0.56915 
0.572357 
0.575556 
0.578746 
0.581927 
0.585099 
0.588263 
0.591417 
0.594562 
0.597699 
0.600826 
0.603944 
0.607052 
0.610152 
0.613242 
0.616323 
0.619394 
0.622456 
0.625509 
0.628552 
0.631585 
0.634609 
0.637623 
0.640627 
0.643622 
0.646606 
0.649581 
0.652546 
0.655501 
0.658446 
0.661381 
0.664306 
0.66722 
0.670125 
0.673019 
0.675903 
0.678777 
0.68164 
0.684493 
0.687336 
0.690168 
0.692989 
0.6958 
0.6986 
0.70139 
0.704169 
0.706937 
0.709694 
0.712441 
0.715177 
0.717901 
0.720615 
0.723318 
0.72601 
0.72869 
0.73136 
0.734018 
0.736666 
0.739302 
0.741926 
0.74454 
0.747142 
0.749732 
0.752312 
0.754879 
0.757435 
0.75998 
0.762513 
0.765034 
0.767544 
0.770042 
0.772528 
0.775003 
0.777466 
0.779916 
0.782355 
0.784782 
0.787197 
0.7896 
0.791991 
0.79437 
0.796737 
0.799091 
0.801433 
0.803764 
0.806081 
0.808387 
0.81068 
0.812961 
0.81523 
0.817486 
0.819729 
0.82196 
0.824179 
0.826385 
0.828578 
0.830758 
0.832926 
0.835082 
0.837224 
0.839354 
0.841471 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-1.60867
-2.42232
-3.65788
-5.05611
-6.53143
-8.04598
-9.58108
-11.1271
-12.6789
-14.2339
-15.7905
-17.348
-18.906
-20.4643
-22.0227
-23.5812
-25.1397
-26.6983
-28.2568
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd6.png');

N = [
32
64
128
256
];
E = [
-11.5292
-13.5289
-15.5285
-17.528
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.7e-05
7.7e-05
0.000708
0.004125
];
T2 = [
0.004516
0.014342
0.053332
0.221363
];
figure(3);
subplot(3,1,3);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

figure(2);
title('Convergence rates');
legend('Dirichlet', 'Neumann', 'Mixed');
xlabel('log n');
ylabel('log of error');
saveas(gcf,'oneErrorInd2.png');
clf;
figure(3);
subplot(3,1,1);
title('Dirichlet');
subplot(3,1,2);
title('Neumann');
subplot(3,1,3);
title('Mixed');
saveas(gcf,'oneTimeInd2.png');
clf;

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
1 
0.999513 
0.99805 
0.995612 
0.992202 
0.987823 
0.982479 
0.976176 
0.968919 
0.960717 
0.951576 
0.941506 
0.930516 
0.918618 
0.905822 
0.892142 
0.877591 
0.862183 
0.845933 
0.828857 
0.810971 
0.792294 
0.772842 
0.752636 
0.731695 
0.71004 
0.687691 
0.66467 
0.641 
0.616705 
0.591807 
0.566331 
0.540302 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-4.32784
-8.81235
-13.2528
-17.6693
-22.0858
-26.4966
-30.9095
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
1 
0.999878 
0.999512 
0.998902 
0.998048 
0.99695 
0.995609 
0.994025 
0.992199 
0.99013 
0.987819 
0.985267 
0.982475 
0.979442 
0.976171 
0.972661 
0.968914 
0.96493 
0.960711 
0.956257 
0.95157 
0.94665 
0.941499 
0.936119 
0.93051 
0.924673 
0.918611 
0.912325 
0.905816 
0.899086 
0.892136 
0.884968 
0.877585 
0.869987 
0.862177 
0.854156 
0.845927 
0.837491 
0.828851 
0.820008 
0.810965 
0.801724 
0.792288 
0.782658 
0.772837 
0.762827 
0.752631 
0.742251 
0.73169 
0.720951 
0.710035 
0.698946 
0.687687 
0.676259 
0.664667 
0.652912 
0.640998 
0.628927 
0.616703 
0.604328 
0.591806 
0.579139 
0.56633 
0.553384 
0.540302 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-4.32364
-8.80346
-13.2449
-17.6608
-22.0742
-26.4841
-30.8899
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
1 
0.99997 
0.999878 
0.999725 
0.999512 
0.999237 
0.998902 
0.998505 
0.998048 
0.997529 
0.99695 
0.99631 
0.995609 
0.994847 
0.994025 
0.993142 
0.992198 
0.991194 
0.990129 
0.989004 
0.987818 
0.986572 
0.985266 
0.9839 
0.982474 
0.980987 
0.979441 
0.977835 
0.97617 
0.974445 
0.97266 
0.970816 
0.968913 
0.96695 
0.964929 
0.962849 
0.96071 
0.958512 
0.956256 
0.953941 
0.951568 
0.949138 
0.946649 
0.944102 
0.941498 
0.938836 
0.936117 
0.933341 
0.930508 
0.927618 
0.924672 
0.921669 
0.91861 
0.915494 
0.912323 
0.909097 
0.905814 
0.902477 
0.899084 
0.895636 
0.892134 
0.888578 
0.884967 
0.881302 
0.877583 
0.873811 
0.869985 
0.866107 
0.862175 
0.858191 
0.854154 
0.850066 
0.845925 
0.841733 
0.837489 
0.833195 
0.828849 
0.824453 
0.820006 
0.81551 
0.810964 
0.806368 
0.801723 
0.797029 
0.792286 
0.787495 
0.782656 
0.77777 
0.772835 
0.767854 
0.762826 
0.757751 
0.75263 
0.747463 
0.74225 
0.736992 
0.731689 
0.726342 
0.72095 
0.715514 
0.710034 
0.704511 
0.698945 
0.693337 
0.687686 
0.681993 
0.676258 
0.670483 
0.664666 
0.658809 
0.652911 
0.646974 
0.640997 
0.634981 
0.628926 
0.622833 
0.616702 
0.610533 
0.604327 
0.598085 
0.591805 
0.58549 
0.579138 
0.572752 
0.56633 
0.559874 
0.553384 
0.54686 
0.540302 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-4.32283
-8.80185
-13.2415
-17.6525
-22.0637
-26.4721
-30.8742
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
1 
0.999992 
0.999969 
0.999931 
0.999878 
0.999809 
0.999725 
0.999626 
0.999512 
0.999382 
0.999237 
0.999077 
0.998902 
0.998711 
0.998505 
0.998284 
0.998048 
0.997796 
0.997529 
0.997247 
0.99695 
0.996637 
0.99631 
0.995967 
0.995609 
0.995235 
0.994847 
0.994443 
0.994025 
0.993591 
0.993141 
0.992677 
0.992198 
0.991703 
0.991193 
0.990669 
0.990129 
0.989574 
0.989003 
0.988418 
0.987818 
0.987202 
0.986572 
0.985926 
0.985266 
0.98459 
0.9839 
0.983194 
0.982473 
0.981738 
0.980987 
0.980222 
0.979441 
0.978646 
0.977835 
0.97701 
0.97617 
0.975314 
0.974444 
0.97356 
0.97266 
0.971745 
0.970816 
0.969872 
0.968913 
0.967939 
0.96695 
0.965947 
0.964929 
0.963896 
0.962848 
0.961786 
0.960709 
0.959618 
0.958512 
0.957391 
0.956255 
0.955105 
0.953941 
0.952762 
0.951568 
0.95036 
0.949137 
0.9479 
0.946648 
0.945382 
0.944102 
0.942807 
0.941498 
0.940174 
0.938836 
0.937484 
0.936117 
0.934736 
0.933341 
0.931931 
0.930508 
0.92907 
0.927618 
0.926152 
0.924671 
0.923177 
0.921668 
0.920146 
0.918609 
0.917059 
0.915494 
0.913915 
0.912323 
0.910716 
0.909096 
0.907462 
0.905814 
0.904152 
0.902476 
0.900787 
0.899084 
0.897367 
0.895636 
0.893892 
0.892134 
0.890362 
0.888577 
0.886779 
0.884966 
0.883141 
0.881301 
0.879449 
0.877583 
0.875703 
0.87381 
0.871904 
0.869985 
0.868052 
0.866106 
0.864147 
0.862175 
0.860189 
0.85819 
0.856179 
0.854154 
0.852116 
0.850065 
0.848001 
0.845925 
0.843835 
0.841732 
0.839617 
0.837489 
0.835348 
0.833194 
0.831028 
0.828849 
0.826657 
0.824452 
0.822236 
0.820006 
0.817764 
0.81551 
0.813243 
0.810963 
0.808672 
0.806367 
0.804051 
0.801722 
0.799382 
0.797029 
0.794663 
0.792286 
0.789897 
0.787495 
0.785082 
0.782656 
0.780219 
0.777769 
0.775308 
0.772835 
0.77035 
0.767854 
0.765345 
0.762825 
0.760294 
0.757751 
0.755196 
0.752629 
0.750052 
0.747462 
0.744862 
0.74225 
0.739626 
0.736992 
0.734346 
0.731689 
0.729021 
0.726341 
0.723651 
0.720949 
0.718237 
0.715514 
0.712779 
0.710034 
0.707278 
0.704511 
0.701733 
0.698945 
0.696146 
0.693337 
0.690516 
0.687686 
0.684844 
0.681993 
0.679131 
0.676258 
0.673376 
0.670482 
0.667579 
0.664666 
0.661742 
0.658809 
0.655865 
0.652911 
0.649947 
0.646974 
0.64399 
0.640997 
0.637994 
0.634981 
0.631958 
0.628926 
0.625885 
0.622833 
0.619772 
0.616702 
0.613622 
0.610533 
0.607435 
0.604327 
0.601211 
0.598084 
0.594949 
0.591805 
0.588652 
0.58549 
0.582318 
0.579138 
0.575949 
0.572752 
0.569545 
0.56633 
0.563106 
0.559874 
0.556633 
0.553384 
0.550126 
0.54686 
0.543585 
0.540302 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-4.32276
-8.80186
-13.237
-17.649
-22.0575
-26.4664
-30.8688
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd7.png');

N = [
32
64
128
256
];
E = [
-16.801
-18.8011
-20.8017
-22.8053
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.6e-05
0.000171
0.000501
0.003991
];
T2 = [
0.001979
0.005878
0.020984
0.092616
];
figure(3);
subplot(3,1,1);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
0 
-0.000477712 
-0.00193151 
-0.00435996 
-0.00776069 
-0.0121304 
-0.0174647 
-0.0237585 
-0.0310056 
-0.0391988 
-0.0483303 
-0.058391 
-0.0693712 
-0.0812601 
-0.094046 
-0.107717 
-0.122258 
-0.137657 
-0.153898 
-0.170965 
-0.188841 
-0.207509 
-0.226951 
-0.247148 
-0.268079 
-0.289725 
-0.312065 
-0.335076 
-0.358736 
-0.383023 
-0.407911 
-0.433377 
-0.459397 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-1.84912
-3.1811
-4.68105
-6.24048
-7.82261
-9.41364
-11.0082
-12.6041
-14.2006
-15.7973
-17.3941
-18.9909
-20.5877
-22.1846
-23.7814
-25.3782
-26.9751
-28.5719
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
0 
-0.000120741 
-0.000485593 
-0.00109447 
-0.00194721 
-0.00304362 
-0.00438343 
-0.0059663 
-0.00779186 
-0.00985965 
-0.0121692 
-0.0147199 
-0.0175111 
-0.0205422 
-0.0238124 
-0.0273209 
-0.0310669 
-0.0350495 
-0.0392676 
-0.0437203 
-0.0484064 
-0.0533249 
-0.0584745 
-0.0638539 
-0.0694619 
-0.075297 
-0.0813579 
-0.0876431 
-0.094151 
-0.10088 
-0.107829 
-0.114995 
-0.122377 
-0.129974 
-0.137783 
-0.145803 
-0.154031 
-0.162465 
-0.171104 
-0.179946 
-0.188988 
-0.198227 
-0.207663 
-0.217291 
-0.227111 
-0.23712 
-0.247315 
-0.257693 
-0.268253 
-0.278991 
-0.289906 
-0.300993 
-0.312252 
-0.323678 
-0.335269 
-0.347023 
-0.358936 
-0.371006 
-0.383229 
-0.395602 
-0.408123 
-0.420789 
-0.433596 
-0.446542 
-0.459622 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-1.64725
-2.87238
-4.30661
-5.82376
-7.37671
-8.94556
-10.5216
-12.1008
-13.6815
-15.2629
-16.8445
-18.4263
-20.0082
-21.59
-23.1719
-24.7538
-26.3357
-27.9176
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
0 
-3.03509e-05 
-0.000121735 
-0.000274147 
-0.000487577 
-0.000762013 
-0.00109744 
-0.00149383 
-0.00195117 
-0.00246942 
-0.00304855 
-0.00368854 
-0.00438934 
-0.0051509 
-0.00597318 
-0.00685614 
-0.00779971 
-0.00880383 
-0.00986846 
-0.0109935 
-0.0121789 
-0.0134247 
-0.0147306 
-0.0160967 
-0.0175228 
-0.0190089 
-0.0205548 
-0.0221606 
-0.023826 
-0.025551 
-0.0273355 
-0.0291793 
-0.0310824 
-0.0330446 
-0.0350659 
-0.037146 
-0.039285 
-0.0414825 
-0.0437386 
-0.046053 
-0.0484256 
-0.0508564 
-0.053345 
-0.0558914 
-0.0584955 
-0.061157 
-0.0638758 
-0.0666518 
-0.0694847 
-0.0723744 
-0.0753208 
-0.0783236 
-0.0813826 
-0.0844977 
-0.0876687 
-0.0908953 
-0.0941775 
-0.0975149 
-0.100907 
-0.104355 
-0.107857 
-0.111413 
-0.115024 
-0.118689 
-0.122407 
-0.126179 
-0.130005 
-0.133883 
-0.137815 
-0.141799 
-0.145835 
-0.149924 
-0.154064 
-0.158256 
-0.1625 
-0.166794 
-0.17114 
-0.175536 
-0.179982 
-0.184478 
-0.189025 
-0.19362 
-0.198265 
-0.202959 
-0.207701 
-0.212492 
-0.217331 
-0.222217 
-0.227152 
-0.232133 
-0.237161 
-0.242236 
-0.247357 
-0.252523 
-0.257736 
-0.262994 
-0.268296 
-0.273644 
-0.279036 
-0.284471 
-0.289951 
-0.295474 
-0.301039 
-0.306648 
-0.312299 
-0.317991 
-0.323726 
-0.329501 
-0.335318 
-0.341175 
-0.347072 
-0.35301 
-0.358986 
-0.365002 
-0.371057 
-0.37715 
-0.383281 
-0.389449 
-0.395655 
-0.401898 
-0.408177 
-0.414492 
-0.420843 
-0.42723 
-0.433651 
-0.440107 
-0.446597 
-0.453121 
-0.459679 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-1.48486
-2.60997
-3.97753
-5.44971
-6.97124
-8.51684
-10.0743
-11.6377
-13.204
-14.7718
-16.3403
-17.9092
-19.4782
-21.0473
-22.6165
-24.1857
-25.7549
-27.3242
-28.8934
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
0 
-7.60851e-06 
-3.04757e-05 
-6.86012e-05 
-0.000121984 
-0.000190625 
-0.000274521 
-0.000373671 
-0.000488075 
-0.00061773 
-0.000762635 
-0.000922786 
-0.00109818 
-0.00128882 
-0.0014947 
-0.00171581 
-0.00195216 
-0.00220373 
-0.00247053 
-0.00275255 
-0.00304979 
-0.00336224 
-0.0036899 
-0.00403276 
-0.00439082 
-0.00476407 
-0.0051525 
-0.00555612 
-0.00597491 
-0.00640886 
-0.00685798 
-0.00732226 
-0.00780167 
-0.00829623 
-0.00880592 
-0.00933074 
-0.00987067 
-0.0104257 
-0.0109959 
-0.0115811 
-0.0121814 
-0.0127968 
-0.0134272 
-0.0140727 
-0.0147333 
-0.0154089 
-0.0160995 
-0.0168051 
-0.0175257 
-0.0182613 
-0.0190119 
-0.0197775 
-0.020558 
-0.0213535 
-0.0221638 
-0.0229892 
-0.0238294 
-0.0246845 
-0.0255545 
-0.0264394 
-0.0273391 
-0.0282537 
-0.0291831 
-0.0301273 
-0.0310863 
-0.0320601 
-0.0330486 
-0.034052 
-0.03507 
-0.0361028 
-0.0371503 
-0.0382124 
-0.0392893 
-0.0403808 
-0.041487 
-0.0426078 
-0.0437431 
-0.0448931 
-0.0460577 
-0.0472368 
-0.0484304 
-0.0496386 
-0.0508613 
-0.0520984 
-0.0533501 
-0.0546161 
-0.0558966 
-0.0571915 
-0.0585008 
-0.0598244 
-0.0611624 
-0.0625147 
-0.0638813 
-0.0652623 
-0.0666574 
-0.0680668 
-0.0694905 
-0.0709283 
-0.0723803 
-0.0738465 
-0.0753267 
-0.0768211 
-0.0783296 
-0.0798522 
-0.0813888 
-0.0829394 
-0.084504 
-0.0860826 
-0.0876751 
-0.0892815 
-0.0909018 
-0.092536 
-0.0941841 
-0.095846 
-0.0975216 
-0.0992111 
-0.100914 
-0.102631 
-0.104362 
-0.106106 
-0.107864 
-0.109635 
-0.111421 
-0.113219 
-0.115031 
-0.116857 
-0.118696 
-0.120549 
-0.122415 
-0.124294 
-0.126187 
-0.128093 
-0.130013 
-0.131945 
-0.133891 
-0.135851 
-0.137823 
-0.139808 
-0.141807 
-0.143819 
-0.145844 
-0.147881 
-0.149932 
-0.151996 
-0.154073 
-0.156162 
-0.158265 
-0.16038 
-0.162508 
-0.164649 
-0.166803 
-0.168969 
-0.171149 
-0.17334 
-0.175545 
-0.177762 
-0.179991 
-0.182233 
-0.184488 
-0.186754 
-0.189034 
-0.191325 
-0.19363 
-0.195946 
-0.198274 
-0.200615 
-0.202968 
-0.205334 
-0.207711 
-0.2101 
-0.212502 
-0.214915 
-0.217341 
-0.219778 
-0.222227 
-0.224689 
-0.227162 
-0.229646 
-0.232143 
-0.234651 
-0.237171 
-0.239703 
-0.242246 
-0.244801 
-0.247367 
-0.249945 
-0.252534 
-0.255135 
-0.257747 
-0.26037 
-0.263005 
-0.26565 
-0.268307 
-0.270976 
-0.273655 
-0.276345 
-0.279047 
-0.281759 
-0.284483 
-0.287217 
-0.289962 
-0.292718 
-0.295485 
-0.298263 
-0.301051 
-0.30385 
-0.30666 
-0.30948 
-0.31231 
-0.315152 
-0.318003 
-0.320865 
-0.323738 
-0.326621 
-0.329514 
-0.332417 
-0.33533 
-0.338254 
-0.341187 
-0.344131 
-0.347085 
-0.350049 
-0.353022 
-0.356006 
-0.358999 
-0.362002 
-0.365015 
-0.368037 
-0.371069 
-0.374111 
-0.377163 
-0.380223 
-0.383294 
-0.386373 
-0.389462 
-0.392561 
-0.395668 
-0.398785 
-0.401911 
-0.405046 
-0.40819 
-0.411344 
-0.414506 
-0.417677 
-0.420857 
-0.424046 
-0.427244 
-0.43045 
-0.433665 
-0.436889 
-0.440121 
-0.443362 
-0.446612 
-0.449869 
-0.453136 
-0.45641 
-0.459693 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-1.35127
-2.38356
-3.68495
-5.11042
-6.59861
-8.11964
-9.65811
-11.2059
-12.7587
-14.3141
-15.871
-17.4287
-18.9868
-20.5451
-22.1035
-23.662
-25.2206
-26.7791
-28.3377
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd8.png');

N = [
32
64
128
256
];
E = [
-11.6989
-13.6888
-15.6837
-17.6805
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
2.9e-05
8.2e-05
0.000849
0.004182
];
T2 = [
0.004933
0.016527
0.059282
0.230938
];
figure(3);
subplot(3,1,2);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

X = [
0
0.03125
0.0625
0.09375
0.125
0.15625
0.1875
0.21875
0.25
0.28125
0.3125
0.34375
0.375
0.40625
0.4375
0.46875
0.5
0.53125
0.5625
0.59375
0.625
0.65625
0.6875
0.71875
0.75
0.78125
0.8125
0.84375
0.875
0.90625
0.9375
0.96875
1
];
V = [
1.00003 
0.999542 
0.998078 
0.995639 
0.992228 
0.987848 
0.982503 
0.976199 
0.968942 
0.960738 
0.951596 
0.941525 
0.930535 
0.918635 
0.905839 
0.892158 
0.877606 
0.862197 
0.845946 
0.828869 
0.810982 
0.792304 
0.772851 
0.752645 
0.731703 
0.710046 
0.687696 
0.664675 
0.641004 
0.616708 
0.591809 
0.566332 
0.540302 
];
figure(1);
subplot(4,2,1);
plot(X, V, '.');
title('Solution: n = 32');
R = [
-1.8745
-3.58475
-5.22641
-6.84088
-8.44466
-10.0442
-11.6422
-13.2394
-14.8365
-16.4334
-18.0302
-19.6271
-21.2239
-22.8208
-24.4176
-26.0145
-27.6113
];
figure(1);
subplot(4,2,2);
plot(R,'.');
title('Residual: n = 32');

X = [
0
0.015625
0.03125
0.046875
0.0625
0.078125
0.09375
0.109375
0.125
0.140625
0.15625
0.171875
0.1875
0.203125
0.21875
0.234375
0.25
0.265625
0.28125
0.296875
0.3125
0.328125
0.34375
0.359375
0.375
0.390625
0.40625
0.421875
0.4375
0.453125
0.46875
0.484375
0.5
0.515625
0.53125
0.546875
0.5625
0.578125
0.59375
0.609375
0.625
0.640625
0.65625
0.671875
0.6875
0.703125
0.71875
0.734375
0.75
0.765625
0.78125
0.796875
0.8125
0.828125
0.84375
0.859375
0.875
0.890625
0.90625
0.921875
0.9375
0.953125
0.96875
0.984375
1
];
V = [
1.00001 
0.999886 
0.99952 
0.99891 
0.998056 
0.996958 
0.995617 
0.994033 
0.992206 
0.990137 
0.987826 
0.985274 
0.982482 
0.979449 
0.976178 
0.972668 
0.96892 
0.964937 
0.960717 
0.956263 
0.951576 
0.946656 
0.941505 
0.936124 
0.930515 
0.924678 
0.918616 
0.91233 
0.905821 
0.89909 
0.89214 
0.884973 
0.877589 
0.869991 
0.862181 
0.85416 
0.84593 
0.837494 
0.828854 
0.820011 
0.810968 
0.801727 
0.792291 
0.782661 
0.772839 
0.76283 
0.752633 
0.742254 
0.731693 
0.720953 
0.710037 
0.698948 
0.687688 
0.676261 
0.664668 
0.652913 
0.640999 
0.628928 
0.616704 
0.604329 
0.591806 
0.579139 
0.566331 
0.553384 
0.540302 
];
figure(1);
subplot(4,2,3);
plot(X, V, '.');
title('Solution: n = 64');
R = [
-1.88411
-3.60015
-5.24156
-6.85003
-8.44387
-10.0311
-11.6155
-13.1985
-14.7809
-16.363
-17.945
-19.5269
-21.1088
-22.6907
-24.2727
-25.8546
-27.4365
];
figure(1);
subplot(4,2,4);
plot(R,'.');
title('Residual: n = 64');

X = [
0
0.0078125
0.015625
0.0234375
0.03125
0.0390625
0.046875
0.0546875
0.0625
0.0703125
0.078125
0.0859375
0.09375
0.101562
0.109375
0.117188
0.125
0.132812
0.140625
0.148438
0.15625
0.164062
0.171875
0.179688
0.1875
0.195312
0.203125
0.210938
0.21875
0.226562
0.234375
0.242188
0.25
0.257812
0.265625
0.273438
0.28125
0.289062
0.296875
0.304688
0.3125
0.320312
0.328125
0.335938
0.34375
0.351562
0.359375
0.367188
0.375
0.382812
0.390625
0.398438
0.40625
0.414062
0.421875
0.429688
0.4375
0.445312
0.453125
0.460938
0.46875
0.476562
0.484375
0.492188
0.5
0.507812
0.515625
0.523438
0.53125
0.539062
0.546875
0.554688
0.5625
0.570312
0.578125
0.585938
0.59375
0.601562
0.609375
0.617188
0.625
0.632812
0.640625
0.648438
0.65625
0.664062
0.671875
0.679688
0.6875
0.695312
0.703125
0.710938
0.71875
0.726562
0.734375
0.742188
0.75
0.757812
0.765625
0.773438
0.78125
0.789062
0.796875
0.804688
0.8125
0.820312
0.828125
0.835938
0.84375
0.851562
0.859375
0.867188
0.875
0.882812
0.890625
0.898438
0.90625
0.914062
0.921875
0.929688
0.9375
0.945312
0.953125
0.960938
0.96875
0.976562
0.984375
0.992188
1
];
V = [
1 
0.999972 
0.99988 
0.999728 
0.999514 
0.999239 
0.998904 
0.998507 
0.99805 
0.997531 
0.996952 
0.996312 
0.995611 
0.994849 
0.994027 
0.993144 
0.9922 
0.991196 
0.990131 
0.989006 
0.98782 
0.986574 
0.985268 
0.983902 
0.982475 
0.980989 
0.979443 
0.977837 
0.976172 
0.974446 
0.972662 
0.970818 
0.968915 
0.966952 
0.964931 
0.96285 
0.960711 
0.958514 
0.956257 
0.953943 
0.95157 
0.949139 
0.94665 
0.944104 
0.941499 
0.938838 
0.936119 
0.933343 
0.93051 
0.92762 
0.924673 
0.92167 
0.918611 
0.915496 
0.912325 
0.909098 
0.905815 
0.902478 
0.899085 
0.895638 
0.892135 
0.888579 
0.884968 
0.881303 
0.877584 
0.873812 
0.869986 
0.866108 
0.862176 
0.858192 
0.854155 
0.850067 
0.845926 
0.841734 
0.83749 
0.833195 
0.82885 
0.824454 
0.820007 
0.815511 
0.810964 
0.806369 
0.801724 
0.79703 
0.792287 
0.787496 
0.782657 
0.77777 
0.772836 
0.767855 
0.762826 
0.757752 
0.75263 
0.747463 
0.742251 
0.736993 
0.73169 
0.726342 
0.72095 
0.715514 
0.710035 
0.704512 
0.698946 
0.693337 
0.687686 
0.681993 
0.676259 
0.670483 
0.664666 
0.658809 
0.652912 
0.646974 
0.640997 
0.634981 
0.628927 
0.622834 
0.616702 
0.610534 
0.604328 
0.598085 
0.591805 
0.58549 
0.579139 
0.572752 
0.56633 
0.559874 
0.553384 
0.54686 
0.540302 
];
figure(1);
subplot(4,2,5);
plot(X, V, '.');
title('Solution: n = 128');
R = [
-1.88725
-3.60631
-5.2478
-6.85249
-8.43926
-10.0172
-11.5908
-13.1621
-14.7324
-16.3022
-17.8717
-19.441
-21.0103
-22.5796
-24.1488
-25.7181
-27.2873
];
figure(1);
subplot(4,2,6);
plot(R,'.');
title('Residual: n = 128');

X = [
0
0.00390625
0.0078125
0.0117188
0.015625
0.0195312
0.0234375
0.0273438
0.03125
0.0351562
0.0390625
0.0429688
0.046875
0.0507812
0.0546875
0.0585938
0.0625
0.0664062
0.0703125
0.0742188
0.078125
0.0820312
0.0859375
0.0898438
0.09375
0.0976562
0.101562
0.105469
0.109375
0.113281
0.117188
0.121094
0.125
0.128906
0.132812
0.136719
0.140625
0.144531
0.148438
0.152344
0.15625
0.160156
0.164062
0.167969
0.171875
0.175781
0.179688
0.183594
0.1875
0.191406
0.195312
0.199219
0.203125
0.207031
0.210938
0.214844
0.21875
0.222656
0.226562
0.230469
0.234375
0.238281
0.242188
0.246094
0.25
0.253906
0.257812
0.261719
0.265625
0.269531
0.273438
0.277344
0.28125
0.285156
0.289062
0.292969
0.296875
0.300781
0.304688
0.308594
0.3125
0.316406
0.320312
0.324219
0.328125
0.332031
0.335938
0.339844
0.34375
0.347656
0.351562
0.355469
0.359375
0.363281
0.367188
0.371094
0.375
0.378906
0.382812
0.386719
0.390625
0.394531
0.398438
0.402344
0.40625
0.410156
0.414062
0.417969
0.421875
0.425781
0.429688
0.433594
0.4375
0.441406
0.445312
0.449219
0.453125
0.457031
0.460938
0.464844
0.46875
0.472656
0.476562
0.480469
0.484375
0.488281
0.492188
0.496094
0.5
0.503906
0.507812
0.511719
0.515625
0.519531
0.523438
0.527344
0.53125
0.535156
0.539062
0.542969
0.546875
0.550781
0.554688
0.558594
0.5625
0.566406
0.570312
0.574219
0.578125
0.582031
0.585938
0.589844
0.59375
0.597656
0.601562
0.605469
0.609375
0.613281
0.617188
0.621094
0.625
0.628906
0.632812
0.636719
0.640625
0.644531
0.648438
0.652344
0.65625
0.660156
0.664062
0.667969
0.671875
0.675781
0.679688
0.683594
0.6875
0.691406
0.695312
0.699219
0.703125
0.707031
0.710938
0.714844
0.71875
0.722656
0.726562
0.730469
0.734375
0.738281
0.742188
0.746094
0.75
0.753906
0.757812
0.761719
0.765625
0.769531
0.773438
0.777344
0.78125
0.785156
0.789062
0.792969
0.796875
0.800781
0.804688
0.808594
0.8125
0.816406
0.820312
0.824219
0.828125
0.832031
0.835938
0.839844
0.84375
0.847656
0.851562
0.855469
0.859375
0.863281
0.867188
0.871094
0.875
0.878906
0.882812
0.886719
0.890625
0.894531
0.898438
0.902344
0.90625
0.910156
0.914062
0.917969
0.921875
0.925781
0.929688
0.933594
0.9375
0.941406
0.945312
0.949219
0.953125
0.957031
0.960938
0.964844
0.96875
0.972656
0.976562
0.980469
0.984375
0.988281
0.992188
0.996094
1
];
V = [
1 
0.999993 
0.99997 
0.999932 
0.999878 
0.99981 
0.999726 
0.999627 
0.999512 
0.999383 
0.999238 
0.999078 
0.998902 
0.998711 
0.998506 
0.998284 
0.998048 
0.997796 
0.99753 
0.997248 
0.99695 
0.996638 
0.99631 
0.995967 
0.995609 
0.995236 
0.994848 
0.994444 
0.994025 
0.993591 
0.993142 
0.992678 
0.992198 
0.991704 
0.991194 
0.990669 
0.990129 
0.989574 
0.989004 
0.988419 
0.987818 
0.987203 
0.986572 
0.985927 
0.985266 
0.984591 
0.9839 
0.983194 
0.982474 
0.981738 
0.980988 
0.980222 
0.979441 
0.978646 
0.977836 
0.97701 
0.97617 
0.975315 
0.974445 
0.97356 
0.97266 
0.971746 
0.970816 
0.969872 
0.968913 
0.967939 
0.966951 
0.965947 
0.964929 
0.963896 
0.962849 
0.961787 
0.96071 
0.959618 
0.958512 
0.957391 
0.956256 
0.955106 
0.953941 
0.952762 
0.951568 
0.95036 
0.949138 
0.9479 
0.946649 
0.945383 
0.944102 
0.942807 
0.941498 
0.940174 
0.938836 
0.937484 
0.936117 
0.934736 
0.933341 
0.931932 
0.930508 
0.92907 
0.927618 
0.926152 
0.924672 
0.923177 
0.921669 
0.920146 
0.91861 
0.917059 
0.915494 
0.913916 
0.912323 
0.910717 
0.909096 
0.907462 
0.905814 
0.904152 
0.902477 
0.900787 
0.899084 
0.897367 
0.895636 
0.893892 
0.892134 
0.890363 
0.888577 
0.886779 
0.884967 
0.883141 
0.881302 
0.879449 
0.877583 
0.875704 
0.873811 
0.871905 
0.869985 
0.868052 
0.866106 
0.864147 
0.862175 
0.860189 
0.858191 
0.856179 
0.854154 
0.852116 
0.850065 
0.848002 
0.845925 
0.843835 
0.841733 
0.839617 
0.837489 
0.835348 
0.833194 
0.831028 
0.828849 
0.826657 
0.824453 
0.822236 
0.820006 
0.817764 
0.81551 
0.813243 
0.810963 
0.808672 
0.806368 
0.804051 
0.801723 
0.799382 
0.797029 
0.794664 
0.792286 
0.789897 
0.787495 
0.785082 
0.782656 
0.780219 
0.777769 
0.775308 
0.772835 
0.77035 
0.767854 
0.765346 
0.762826 
0.760294 
0.757751 
0.755196 
0.75263 
0.750052 
0.747463 
0.744862 
0.74225 
0.739627 
0.736992 
0.734346 
0.731689 
0.729021 
0.726342 
0.723651 
0.72095 
0.718237 
0.715514 
0.712779 
0.710034 
0.707278 
0.704511 
0.701734 
0.698945 
0.696146 
0.693337 
0.690516 
0.687686 
0.684845 
0.681993 
0.679131 
0.676258 
0.673376 
0.670483 
0.667579 
0.664666 
0.661742 
0.658809 
0.655865 
0.652911 
0.649947 
0.646974 
0.64399 
0.640997 
0.637994 
0.634981 
0.631959 
0.628926 
0.625885 
0.622833 
0.619772 
0.616702 
0.613622 
0.610533 
0.607435 
0.604327 
0.601211 
0.598085 
0.594949 
0.591805 
0.588652 
0.58549 
0.582318 
0.579138 
0.575949 
0.572752 
0.569545 
0.56633 
0.563106 
0.559874 
0.556633 
0.553384 
0.550126 
0.54686 
0.543585 
0.540302 
];
figure(1);
subplot(4,2,7);
plot(X, V, '.');
title('Solution: n = 256');
R = [
-1.88836
-3.60905
-5.25081
-6.85325
-8.43525
-10.0064
-11.5717
-13.1339
-14.6944
-16.254
-17.8132
-19.372
-20.9308
-22.4894
-24.048
-25.6066
-27.1652
];
figure(1);
subplot(4,2,8);
plot(R,'.');
title('Residual: n = 256');
saveas(gcf,'oneRSInd9.png');

N = [
32
64
128
256
];
E = [
-15.0181
-16.8584
-18.7847
-20.7601
];
figure(2);
plot(log2(N),E,'-', 'MarkerSize', 5);
hold on;

T1 = [
0.000132
8.1e-05
0.000602
0.004678
];
T2 = [
0.004541
0.014966
0.052961
0.214968
];
figure(3);
subplot(3,1,3);
plot(N,T1, '-', 'MarkerSize', 5);
hold on;
plot(N,T2, '-', 'MarkerSize', 5);
legend('Lapcak', 'Multigrid');
ylabel('time(s)');
xlabel('n');

figure(2);
title('Convergence rates');
legend('Dirichlet', 'Neumann', 'Mixed');
xlabel('log n');
ylabel('log of error');
saveas(gcf,'oneErrorInd3.png');
clf;
figure(3);
subplot(3,1,1);
title('Dirichlet');
subplot(3,1,2);
title('Neumann');
subplot(3,1,3);
title('Mixed');
saveas(gcf,'oneTimeInd3.png');
clf;
